// formPackage/pages/invite/inviteManagerList/inviteManagerList.js
import { queryMyInviteList } from "../../../../service/invite_service"
let app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    themeStyle: "",
    exStatus: 0,
    examineStatus: 1,
    switchArr: [
      {
        title: "待审核",
        key: 1,
      },
      {
        title: "审核成功",
        key: 2
      },
      {
        title: "审核失败",
        key: 3
      },
    ],
    inviteList: [

    ],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },


  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if (app.globalData.themeStyle) {
      this.setData({
        themeStyle: app.globalData.themeStyle
      })
    }
    this.queryMyInviteList();
  },
  switchAction(e) {
    let index = e.currentTarget.dataset.index;
    let item = e.currentTarget.dataset.item;
    this.setData({
      exStatus: index,
      examineStatus: item.key
    })
    this.queryMyInviteList();
  },
  //获取我自己的招募列表:
  queryMyInviteList() {
    wx.showLoading();
    queryMyInviteList(this.data.examineStatus).then(res => {
      wx.hideLoading();
      console.log("JJLog:获取到的招募列表是:" + JSON.stringify(res));
      if (res.code == 200) {
        this.setData({
          inviteList: res.data
        })
      }
    }).catch(err => {
      console.error("JJLog:queryMyInviteList", err);
      wx.hideLoading();
      wx.showToast({
        title: err || "查询失败",
        icon: "none"
      })
    })
  },
  pushToDetail(e){
    let id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/formPackage/pages/invite/inviteCheckDetail/inviteCheckDeail?id=' + id,
    })
  },






})